home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / WWW / http / www.cu-amiga.co.uk / features / c-tutorial / Part-6.lzx / Part-6 / asl2 / drawwin.c < prev    next >
C/C++ Source or Header  |  1984-05-19  |  2KB  |  61 lines

  1. #include "drawwin.h"
  2. #include "bitmap.h"
  3. #include "menu.h"
  4. #include "screen.h"
  5.  
  6. #include<graphics/rastport.h>
  7.  
  8. #include<stdio.h>
  9.  
  10. #include<clib/graphics_protos.h>
  11. #include<clib/intuition_protos.h>
  12.  
  13. /* Global record of our tool window */
  14. struct Window* drawwin = NULL;
  15.  
  16. int openDrawWin()
  17. {
  18.     struct Screen* scr = getScreen();
  19.     /* Open our drawing window */
  20.     if(drawwin = OpenWindowTags(NULL,
  21.                                                             WA_Left,                    0,
  22.                                                             WA_Top,                        0,
  23.                                                             /* Make the window the same size as the screen */
  24.                                                             WA_Width,                    scr->Width,
  25.                                                             WA_Height,                scr->Height,
  26.                                                             WA_Flags,                    WFLG_BACKDROP | WFLG_BORDERLESS | WFLG_REPORTMOUSE | WFLG_SUPER_BITMAP,
  27.                                                             WA_IDCMP,                    IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_MENUPICK,
  28.                                                             WA_CustomScreen,    scr,
  29.                                                             WA_SuperBitMap,        getBitmap(),
  30.                                                             TAG_DONE,                    0))
  31.     {
  32.         /* Clear our window, since our new bitmap may not be cleared already */
  33.         SetRast(drawwin->RPort, 0);
  34.         /* Set the drawing mode to draw only the foreground of text, not the background */
  35.         SetDrMd(drawwin->RPort, JAM1);
  36.         /* Attach menu strip to drawing window */
  37.         if(SetMenuStrip(drawwin, getMenuStrip()))
  38.             return TRUE;
  39.         else
  40.             printf("Error: could not attach menus to drawing window\n");
  41.     }
  42.     else
  43.         printf("Error: could not open drawing window\n");
  44.     return FALSE;
  45. }
  46.  
  47. void closeDrawWin()
  48. {
  49.     if(drawwin)
  50.     {
  51.         ClearMenuStrip(drawwin);
  52.         CloseWindow(drawwin);
  53.         drawwin = NULL;
  54.     }
  55. }
  56.  
  57. struct Window* getDrawWin()
  58. {
  59.     return drawwin;
  60. }
  61.